// DlgTag.cpp : implementation file
//

#include "stdafx.h"
#include "bdc.h"
#include "DlgTag.h"
#include "afxdialogex.h"

using namespace bdc::dlg;


// DlgTag dialog

IMPLEMENT_DYNAMIC(DlgTag, CDialogEx)

DlgTag::DlgTag(CWnd* pParent /*=NULL*/)
	: CDialogEx(DlgTag::IDD, pParent)
{

}

DlgTag::~DlgTag()
{
}

void DlgTag::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_TAG_NAME, tagName); 
}


BEGIN_MESSAGE_MAP(DlgTag, CDialogEx)
	ON_BN_CLICKED(IDC_TAG_OK, OnOK)
	ON_BN_CLICKED(IDC_TAG_CANCL, OnCancel)
END_MESSAGE_MAP()


// DlgTag message handlers


BOOL DlgTag::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  Add extra initialization here
	this->UpdateData(FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}


void DlgTag::OnOK()
{
	// TODO: Add your specialized code here and/or call the base class
	CDialogEx::OnOK();

	CbdcApp* app = (CbdcApp*) AfxGetApp();
	BOOL success = app->serviceInvoker.updateTag(tagId, tagName.GetString());

	if(!success) {
		MessageBox(_T("false"));
	}
}
